<i><%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
	<!DOCTYPE html>
	<html>
<head>
<meta charset="UTF-8">
<title>服务-义工中心 编辑页面</title>
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<jsp:include page="../com/header.jsp"></jsp:include>
<script type="text/javascript" src="../../js/comm/editcomm.js"></script>
<script type="text/javascript">
		$(function(){
			$("#saveOrupdate").click(function(){
				$("#vsdc_PicURL").val(imgUrl);
				if (!$('#vSDCContent').find('#myImageShow').attr('src')) {
					myAlert("请上传图片");
					return;
				}
				saveData(root + 'cms/vSDC/saveVSDC','vSDCList.jsp');
			});
			var tId = getUrlParam("id");
			if (!tId) {
				myAlert('id参数不能为空');
				return;
			}
			$.ajax({
				url : root + 'cms/vSDC/findVSDCById',
				type : 'post',
				dataType : 'json',
				data : {
					modelId : tId
				},
				success : function(data) {
					console.log(data);
					if (data.code == 1) {
						var contentHtml = $('#vSDCTmpl').render(data.object, {
							mydata : data
						});
						$('#vSDCContent').html(contentHtml);
						ue = UE.getEditor("vsdc_Content");
						ue.addListener("ready", function() {
							if (data.object.vsdc_Content)
								ue.setContent(data.object.vsdc_Content);
						});
					}else{
						var contentHtml = $('#vSDCTmpl').render("");
						$('#vSDCContent').html(contentHtml);
					}
				}
			});
			
			//上传图片
			upload("");
			$('#vSDCContent').on('click','#uploadPhotoFile', function () {
				upload("vSDC");
	        });
		});
		
</script>
</head>
<body>
	<section>
		<div>
			<div class="col-xs-12">
				<div class="box" style="height:900px">
					<div class="box-header">
						<br> <input type="button" value="确定" id="saveOrupdate"
							class="btn btn-success"> <input type="button"
							onclick="backAction('vSDCList.jsp');" class="btn btn-info"
							value="返回">
					</div>
					<form id="submit_form" class="form-horizontal">
						<div class="tab" id="vSDCContent"></div>
					</form>
				</div>
			</div>
		</div>
	</section>
	<script type="text/x-jsrender" id="vSDCTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">活动名称：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写义工活动名称" class="form-control input-sm" data-rule="required;length[0~50]" id="vsdcName" name="vsdc_Name" value="{{:vsdc_Name}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">组织照片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
						<img id="myImageShow" src="../../{{:vsdc_PicURL}}" width="100px" height="100px" />
                        	<input type="hidden" id="vsdc_PicURL" name="vsdc_PicURL" value="{{:vsdc_PicURL}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
						</div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">排序值：</label>
       				 <div class="col-md-4">
						<input type="text" placeholder="请填写排序值" class="form-control input-sm" data-rule="length[1~10];plus" maxlength="10" id="sort" name="sort" value="{{:sort}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">组织简介：</label>
					<div class="col-md-5">
       				    <textarea class="form-control" id="vsdc_Introduce" name="vsdc_Introduce" rows="8"
       				    placeholder="请填写组织简介"
       				    data-rule="required;length[1~255];" date-tip="请输入简介1-255字符"
       				    value="{{:vsdc_Introduce}}" style="resize:none;">{{:vsdc_Introduce}}</textarea>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">组织详细内容：</label>
       				 <div class="col-md-3">
						<div  id="vsdc_Content" name="vsdc_Content" style="height:200px;width:760px"></div>					
					</div>
      			</div>
			</fieldset>
	</script>
</body>
	</html></i>